import request from "../request/request";
import {UserData} from "@/type/UserData.ts";

export function getUserList(currentPage: number){

    return request({
        url: 'api/user/getList',
        method: 'GET',
        params: {
            currentPage: currentPage
        }
    })
}

export function removeUser(id: number){
    return request({
        url: `api/user/delete/${id}`,
        method: "DELETE"
    })
}

export function updateUserInfo(user: UserData){

    return request({
        url: 'api/user/updateUserInfo',
        method: 'POST',
        data: user
    })
}

export function updateUserRole(userId: number, roleIds: Array<number>){

    return request({
        url: `api/user/updateRole/${userId}`,
        method: 'POST',
        data: roleIds
    })
}

export function getUserRole(userId: number){

    return request({
        url: 'api/user/getUserRole',
        method: "GET",
        params: {
            userId: userId
        }
    })
}